/*
 * copyright (c) 2009 Alexandr [Sn@ble] Surnin
 *
 * This file is part of FrameSeeker.
 *
 * FrameSeeker is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FrameSeeker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You can read the full version of GNU LGPL in
 * http://www.gnu.org/copyleft/lesser.html
 */


#ifndef FSHIST_H
#define FSHIST_H

#include <QObject>

#include <QImage>

#include <QDebug>


/** Histogram class
  * Calculate histograms
  * \author Alexandr [Sn@ble] Surnin
  */
class FSHist : public QObject {
    Q_OBJECT
public:
    FSHist();

    /** Construct a histogram from image
      * \note There is no calculation!
      * Use "calculate" for do it directly
      * \sa calculate()
      * \param _image Image
      */
    FSHist(QImage *_image);

public slots:

    /** Set image data for histogram
      * \param _image Image
      */
    void setImage(QImage *_image);


    /** Calculate histogram
      * \sa setImage()
      */
    void calculate();

    quint64 r(int index);
    quint64 g(int index);
    quint64 b(int index);

private:
    quint64 red[256];
    quint64 green[256];
    quint64 blue[256];
    QImage *image;

};

#endif // FSHIST_H
